#include "subWindow.h"

SubWindow::SubWindow(void) {

}

SubWindow::~SubWindow(void) {

}

/** 
	Function: SubWindow Constructor
	Parameters:
		hwnd = parent window's hwnd
		hInstance = instance of the program
		WindowProc = the function that handles the window
		dialogResource = the dialog's window template
		x = window's x-position
		y = window's y-position
		height = window's height
		width = window's width
	Description:
		The constructor that constructs the SubWindow.
*/
SubWindow::SubWindow(HWND hwnd, HINSTANCE hInstance, DLGPROC WindowProc, int dialogResource, int x, int y, int height, int width) {
	// Create and store the window
	this->window = CreateDialogParamA(hInstance, MAKEINTRESOURCE(dialogResource), hwnd, WindowProc, 0);
	this->x = x;
	this->y = y;
	this->height = height;
	this->width = width;

	// Move/Reshape the window
	MoveWindow(window, x, y, width, height, true);
}

/** 
	Function: SubWindow::reshape
	Parameters:
		x = window's new x-position
		y = window's new y-position
		width = window's new width
		height = window's new height
	Description:
		Moves and sets the new position and size of window.
*/
void SubWindow::reshape(int x, int y, int width, int height) {
#ifdef _WINDOWS
	MoveWindow(window, x, y, width, height, TRUE);
#endif
	this->x = x;
	this->y = y;
	this->width = width;
	this->height = height;
}
